package com.baiwei.vpnapi.dao;

import com.baiwei.vpnapi.entity.VpnAdvert;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VpnAdvertMapper extends BaseMapper<VpnAdvert> {

    @Select("select ad_id, ad_name, loc_type, ad_type, ad_image, jump_url, sort from app_ads  where target_user_type like concat('%',#{userType},'%') and status = 1 and loc_type = 1 order by sort;")
    List<VpnAdvert> getBannerAdverts(String userType);

    @Select("select ad_id, ad_name, loc_type, ad_type, ad_image, jump_url from app_ads where target_user_type like concat('%',#{userType},'%') and status = 1 and loc_type = 2 limit 1;")
    VpnAdvert getLaunchAdvert(String userType);

    @Select("select ad_id, ad_name, loc_type, ad_type, ad_image, jump_url from app_ads where target_user_type like concat('%',#{userType},'%') and status = 1 and loc_type = 3 limit 1;")
    VpnAdvert getAlertAdvert(String userType);
}
